<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>简单计数器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            display: flex;
            height: 100vh;
            justify-content: center;
            align-items: center;
        }
        .counter-container {
            background-color: #fff;
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        .counter-value {
            font-size: 48px;
            margin: 20px 0;
        }
        .buttons button {
            font-size: 18px;
            padding: 10px 20px;
            margin: 5px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        .buttons button.increment {
            background-color: #4CAF50;
            color: white;
        }
        .buttons button.decrement {
            background-color: #f44336;
            color: white;
        }
        .buttons button.reset {
            background-color: #555;
            color: white;
        }
    </style>
</head>
<body>

    <div class="counter-container">
        <h1>计数器</h1>
        <div class="counter-value" id="counter">0</div>
        <div class="buttons">
            <button class="increment" id="incrementBtn">增加</button>
            <button class="decrement" id="decrementBtn">减少</button>
            <button class="reset" id="resetBtn">重置</button>
        </div>
    </div>

    <script>
        // 获取元素
        const counterValue = document.getElementById('counter');
        const incrementBtn = document.getElementById('incrementBtn');
        const decrementBtn = document.getElementById('decrementBtn');
        const resetBtn = document.getElementById('resetBtn');

        // 初始化计数值
        let count = 0;

        // 增加计数
        incrementBtn.addEventListener('click', () => {
            count++;
            counterValue.textContent = count;
        });

        // 减少计数
        decrementBtn.addEventListener('click', () => {
            if (count > 0) {
                count--;
                counterValue.textContent = count;
            }
        });

        // 重置计数
        resetBtn.addEventListener('click', () => {
            count = 0;
            counterValue.textContent = count;
        });
    </script>

</body>
</html>